<?php

namespace App\Services\WxMass\Filter;

/**
 * 过滤规则抽象类
 * @package App\Services\WxMass\Filter
 */
abstract class FilterAbstract implements FilterInterface
{
    //存储数据
    protected $inputData;
    //存储规则类别
    protected $inputType;
    protected $inputTagid = 0;
    protected $inputOpenids = [];
    protected $inputArea = ['country' => '', 'province' => '', 'city' => ''];
    protected $inputFile = '';

    protected $outputData;
    protected $outputType;
    protected $outputTagid = 0;
    protected $outputOpenids = [];
    /**
     * 构造函数
     */
    public function __construct()
    {

    }

    /**
     * 格式化存储规则格式
     * @return array
     */
    public function formatInputData()
    {
        $this->inputData = [
            'type' => $this->inputType,
            'tagid' => $this->inputTagid,
            'openids' => $this->inputOpenids,
            'area' => $this->inputArea,
            'file' => $this->inputFile,
        ];
        return $this->inputData;
    }

    /**
     * 格式化群发输出格式
     * @return array
     */
    public function formatOutputData()
    {
        $this->outputData = [
            'type' => $this->outputType,
            'tagid' => $this->outputTagid,
            'openids' => $this->outputOpenids,
        ];
        return $this->outputData;
    }
}